package fc.sj.study.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Button;
import android.widget.Toast;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import fc.sj.study.Bean.UserBean;
import fc.sj.study.R;
import fc.sj.study.UserLoginView;
import fc.sj.study.presenter.UserLoginPresenter;

public class LoginMvpActivity extends AppCompatActivity implements UserLoginView{

    @Bind(R.id.bt_login)
    Button btLogin;

    private UserLoginPresenter userLoginListener;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login_mvp);
        ButterKnife.bind(this);
        userLoginListener=new UserLoginPresenter(this);
    }


    @OnClick(R.id.bt_login)
    public void onClick() {
        userLoginListener.login();
    }

    @Override
    public String getUserName() {
        return null;
    }

    @Override
    public String getPassword() {
        return null;
    }

    @Override
    public void clearUserName() {

    }

    @Override
    public void clearPassword() {

    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

    @Override
    public void toMainActivity(UserBean user) {
        Toast.makeText(this, user.getUsername() +
                " login success , to MainActivity", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void showFailedError() {
        Toast.makeText(this, " login faild , to MainActivity", Toast.LENGTH_SHORT).show();
    }
}
